# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-pypdns
pkgname=('python2-pypdns' 'python-pypdns')
_pkgname=pypdns
pkgver=2.2.8
pkgrel=1
pkgdesc='Python API for PDNS.'
arch=('any')
url='https://pypi.org/project/pypdns/#files'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('56e11d06b70c7956800958000caa1002a320de02023ec0e13387f9a7841cc6b167bf42fc55b491c789f212f06a88ffe103e8ed64cc6898a575faa853523bef6d')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-pypdns() {
  depends=('python2' 'python2-requests-cache')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

package_python-pypdns() {
  depends=('python' 'python-requests-cache')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" -O1 --skip-build
}

